/*****************************************************************************************
This file is a part of Arise library.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

Arise Engine		IScene2d.h

					E-mail:		arise_engine@mail.ru

created:			01.05.2008
last changes:		03.05.2008
*****************************************************************************************/
#pragma once
#include "..\engine\BaseObject.h"
#include "..\engine\ConfigTable.h"
#include "..\gui\Font.h"
#include "Sprite.h"

class IScene2d: public BaseObject
{
private:

	bool LoadSpriteHeader(SpriteHeader& header, const std::string& template_name, ConfigTable* config_table);
	bool LoadFontHeader(FontHeader& header, const std::string& template_name, ConfigTable* config_table);
	float m_scale_factor_x;
	float m_scale_factor_y;

public:
	IScene2d();
	virtual ~IScene2d();

	std::vector<Sprite*>	m_sprites;
	std::vector<Font*>		m_fonts;
	TexturePool				m_texture_pool;
	void*					m_render_device;
	FileSystem*				m_file_system;
	Settings*				m_settings;

	Sprite*		CreateSprite(const std::string& tex_name, float frame_x, float frame_y, float width, float height);
	Sprite*		CreateSprite(LPDIRECT3DTEXTURE9 tex, float frame_x, float frame_y, float width, float height);
	Sprite*		CreateSprite(const std::string& template_name, ConfigTable* config_table);
	Sprite*		CreateSprite(const SpriteHeader& sprite_header);
	Font*		CreateFont(const std::string& font_name);
	Font*		CreateFont(const FontHeader& font_header);
	Font*		CreateFont(const std::string& template_name, ConfigTable* config_table);
	DWORD		CreateColor(const std::string& template_name, const std::string& variable_name, ConfigTable* config_table);
	void		Release();

	void		SetScaleFactor(float x, float y){m_scale_factor_x = x; m_scale_factor_y = y;}
};
